<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateWxRepliesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('wx_replies', function (Blueprint $table) {
            $table->increments('id');
            $table->text('content')->comment('回复内容');
            $table->string('type')->default('')->comment('回复类型');
            $table->unsignedInteger('rule_id')->comment('关联规则得id');
            $table->foreign('rule_id')->references('id')->on('rules')->onDelete('cascade');

            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('wx_replies');
    }
}
